using UnityEngine;
using UnityEngine.EventSystems;

public class UI_StorageSlot : UI_ItemSlot
{
    private Inventory_Storage storage;
    public override void OnPointerDown(PointerEventData eventData)
    {
        if (storage == null || itemInSlot == null)
            return;
        bool isClickCtrl = Input.GetKey(KeyCode.LeftControl);
        bool isRightMouseButton = eventData.button == PointerEventData.InputButton.Right;
        if (isClickCtrl && isRightMouseButton)
        {
            storage.RemoveOneItemInOneSlot(itemInSlot);
            itemToolTip.ShowToolTip(false, null);
            return;
        }
        bool isPress = Input.GetKey(KeyCode.LeftControl);

        if (slotType == SlotType.PlayerInventorySlot)
            storage.FromPlayerToStorage(itemInSlot, isPress);

        else if (slotType == SlotType.PlayerStorageSlot)
            storage.FromStorageToPlayer(itemInSlot, isPress);
        itemToolTip.ShowToolTip(false, null);
    }
    public void SetStorageInventory(Inventory_Storage storage) => this.storage = storage;
}
